package com.zjitc.dao.Impl;

import com.zjitc.dao.SingletonTemplate;
import com.zjitc.dao.UserDao;
import com.zjitc.dao.UserRowMapper;
import com.zjitc.model.User;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("userDao")
public class UserDaoImpl implements UserDao {
    public List<User> find_all() {
        JdbcTemplate jdbcTemplate= SingletonTemplate.getJdbcTemplate();
        String sql="SELECT * FROM users";
        List<User> users= jdbcTemplate.query(sql,new UserRowMapper());
        return users;


    }
}
